# -*- coding: utf-8 -*-

# pip install click
import click


@click.command()
# 命令参数两种格式都有时使用长参数名作为函数参数
@click.option('-n', '--number', type=int, help='input a number', default=1, show_default=True)
@click.option('-m', '--message', type=str, help='input a message', required=True)
def set_function(number: int, message: str):  # 这里使用参数名n报错
    click.echo(f'number={number},message={message}.')


@click.group()
def group():
    pass


@group.command()
@click.option('-n', '--number', type=int, help='input a number', default=1, show_default=True)
def set_number(number: int, ):
    click.echo(f'number={number}.')

    pass


@group.command()
@click.option('-m', '--message', type=str, help='input a message', required=True)
def set_message(message: str):
    click.echo(f'message={message}.')

    pass


if __name__ == '__main__':
    # set_function()
    group()  # 按组：函数名中的下划线变成减号
    pass
